﻿using ShineTech.Domain.SeedWork;
using System;
using System.Collections.Generic;
using System.Text;

namespace ShineTech.Domain.Models.Missons
{
    /// <summary>
    /// 任务
    /// </summary>
    public class Misson : Entity, IAggregateRoot
    {
        public string Name { get; private set; }

        public Guid KanbanId { get; set; }

        public bool IsComplete { get; private set; }

        public Guid CreatedUserId { get; private set; }

        public string CreatedUserName { get; private set; }

        public DateTime CreatedTime { get; private set; }

        public void UpdateName(string name) 
        {
            this.Name = name;
        }
        public void Complete() 
        {
            this.IsComplete = true;
        }




        public string Description { get; private set; }

        public Misson(DateTime createdTime, string name, Guid createdUserId, string createdUserName, Guid kanbanId)
        {
            if (string.IsNullOrEmpty(name))
                throw CustomException.NullArgument(nameof(name));
            if (string.IsNullOrEmpty(createdUserName))
                throw CustomException.NullArgument(nameof(createdUserName));
            KanbanId = kanbanId;
            CreatedTime = createdTime;
            Name = name;
            CreatedUserId = createdUserId;
            CreatedUserName = createdUserName;
        }

        protected Misson()
        {

        }




    }
}
